﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace PJ.Presentation
{
    public abstract class ModelViewCommand<I> : ICommand
        where I : IViewModel
    {
        private readonly I m_ModelView;

        public ModelViewCommand(I modelView)
        {
            if (modelView == null)
                throw new ArgumentNullException();
            m_ModelView = modelView;
        }

        public abstract bool CanExecute(object parameter);

        public event EventHandler CanExecuteChanged
        {
            add { CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value; }
        }

        public abstract void Execute(object parameter);

    }
}
